package com.lanhao.aot.wst;

import org.apache.commons.io.IOUtils;
import org.apache.xmlbeans.impl.common.IOUtil;

import com.aliyun.openservices.shade.com.alibaba.fastjson.JSON;
import com.aliyun.openservices.shade.com.alibaba.fastjson.JSONObject;
import com.iflytek.wst.gateway.sdk.enums.Scheme;
import com.iflytek.wst.gateway.sdk.model.ApiResponse;

public class WstUtil {
	public static void main(String[] args) {
		ApiResponse response = WstRestClient.getInstance().getUserInfoByToken("sdkjfiowejfioj");
		byte[] body = response.getBody();
		String s = new String(body);
		System.out.println("返回消息体s=" + s);
		if (response.getCode() == 200) {
			JSONObject parseObject = JSON.parseObject(s);
			int errCode = parseObject.getIntValue("errCode");
			String errMsg = parseObject.getString("errMsg");
			// 标识成功
			if(errCode == -1) {
				System.out.println("成功了");
			}
			System.out.println("错误原因：" + errMsg);
		} else {
			String message = response.getMessage();
			System.out.println("错误原因：" + message);
		}
		System.out.println(Scheme.valueOf("HTTP"));
		System.out.println(Scheme.HTTP.name());
	}
}
